package com.backend.system.beans.role;

import cn.hutool.core.bean.BeanUtil;
import com.backend.system.dao.entity.Role;
import com.backend.system.util.TimeUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 角色查询vo
 *
 * @author backend-manage
 */
@ApiModel
@Data
public class RoleQueryVO implements Serializable {
    @Serial
    private static final long serialVersionUID = -1270841540448724022L;

    /**
     * 角色ID
     */
    @ApiModelProperty("角色ID")
    private Long id;

    /**
     * 角色编码
     */
    @ApiModelProperty("角色编码")
    private String code;

    /**
     * 角色名
     */
    @ApiModelProperty("角色名")
    private String roleName;

    /**
     * 备注
     */
    @ApiModelProperty("备注")
    private String remark;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = TimeUtil.DEFAULT_DATE_TIME_PATTERN, timezone = TimeUtil.GMT_8)
    private LocalDateTime createTime;

    public static RoleQueryVO convert(Role role) {
        RoleQueryVO vo = new RoleQueryVO();
        BeanUtil.copyProperties(role, vo);
        return vo;
    }
}
